public class BuyHouse {
    public static void main(String[] args) {
        Person p = new Person();
        p.buyHome(new Worker());
        p.buyHome(new Officer());
        p.buyHome(new Business());
    }
}

class Person{
    public void buyHome(GetMoney method){
        method.money();
    }
}

interface GetMoney{
    public void money();
}

class Business implements GetMoney{

    @Override
    public void money() {
        System.out.println("商人生意挣钱");
    }
}
class Worker implements GetMoney{

    @Override
    public void money() {
        System.out.println("工人打工挣钱");
    }
}
class Officer implements GetMoney{

    @Override
    public void money() {
        System.out.println("当官别人送");
    }
}

